﻿using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using System.IO;

namespace TrackIT.Common.Factories
{
    [ContractClass(typeof(WorkStreamContract))]
    public interface IWorkStreamFactory
    {
        Stream CreateStream(string filename);
    }

    [ExcludeFromCodeCoverage]
    [ContractClassFor(typeof(IWorkStreamFactory))]
    public class WorkStreamContract
    {
        public Stream CreateStream(string filename)
        {
            Contract.Requires(!string.IsNullOrWhiteSpace(filename));
            Contract.Ensures(Contract.Result<Stream>() != null);

            return default(Stream);
        }
    }
}